function quicktags(a){return new QTags(a)}function edInsertContent(a,b){return QTags.insertContent(b)}function edButton(a,b,c,d,e){return QTags.addButton(a,b,c,d,e,"",-1)}var QTags,edCanvas,edButtons=[],edAddTag=function(){},edCheckOpenTags=function(){},edCloseAllTags=function(){},edInsertImage=function(){},edInsertLink=function(){},edInsertTag=function(){},edLink=function(){},edQuickLink=function(){},edRemoveTag=function(){},edShowButton=function(){},edShowLinks=function(){},edSpell=function(){},edToolbar=function(){};!function(){function a(a){return a=a||"",a=a.replace(/&([^#])(?![a-z1-4]{1,8};)/gi,"&#038;$1"),a.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}var b,c=function(a){var b,d,e,f;"undefined"!=typeof jQuery?jQuery(document).ready(a):(b=c,b.funcs=[],b.ready=function(){if(!b.isReady)for(b.isReady=!0,d=0;d<b.funcs.length;d++)b.funcs[d]()},b.isReady?a():b.funcs.push(a),b.eventAttached||(document.addEventListener?(e=function(){document.removeEventListener("DOMContentLoaded",e,!1),b.ready()},document.addEventListener("DOMContentLoaded",e,!1),window.addEventListener("load",b.ready,!1)):document.attachEvent&&(e=function(){"complete"===document.readyState&&(document.detachEvent("onreadystatechange",e),b.ready())},document.attachEvent("onreadystatechange",e),window.attachEvent("onload",b.ready),(f=function(){try{document.documentElement.doScroll("left")}catch(a){return void setTimeout(f,50)}b.ready()})()),b.eventAttached=!0))},d=function(){var a,b=new Date;return a=function(a){var b=a.toString();return b.length<2&&(b="0"+b),b},b.getUTCFullYear()+"-"+a(b.getUTCMonth()+1)+"-"+a(b.getUTCDate())+"T"+a(b.getUTCHours())+":"+a(b.getUTCMinutes())+":"+a(b.getUTCSeconds())+"+00:00"}();b=QTags=function(a){if("string"==typeof a)a={id:a};else if("object"!=typeof a)return!1;var d,e,f,g,h,i=this,j=a.id,k=document.getElementById(j),l="qt_"+j;return!(!j||!k)&&(i.name=l,i.id=j,i.canvas=k,i.settings=a,"content"!==j||"string"!=typeof adminpage||"post-new-php"!==adminpage&&"post-php"!==adminpage?f=l+"_toolbar":(edCanvas=k,f="ed_toolbar"),d=document.getElementById(f),d||(d=document.createElement("div"),d.id=f,d.className="quicktags-toolbar"),k.parentNode.insertBefore(d,k),i.toolbar=d,e=function(a){a=a||window.event;var b,c=a.target||a.srcElement,d=c.clientWidth||c.offsetWidth;d&&/ ed_button /.test(" "+c.className+" ")&&(i.canvas=k=document.getElementById(j),b=c.id.replace(l+"_",""),i.theButtons[b]&&i.theButtons[b].callback.call(i.theButtons[b],c,k,i))},h=function(){window.wpActiveEditor=j},g=document.getElementById("wp-"+j+"-wrap"),d.addEventListener?(d.addEventListener("click",e,!1),g&&g.addEventListener("click",h,!1)):d.attachEvent&&(d.attachEvent("onclick",e),g&&g.attachEvent("onclick",h)),i.getButton=function(a){return i.theButtons[a]},i.getButtonElement=function(a){return document.getElementById(l+"_"+a)},i.init=function(){c(function(){b._buttonsInit(j)})},i.remove=function(){delete b.instances[j],d&&d.parentNode&&d.parentNode.removeChild(d)},b.instances[j]=i,void i.init())},b.instances={},b.getInstance=function(a){return b.instances[a]},b._buttonsInit=function(a){function c(a){var c,e,f,g,h,i,j,k,l,m=",strong,em,link,block,del,ins,img,ul,ol,li,code,more,close,";i=d.instances[a],c=i.canvas,e=i.name,f=i.settings,h="",g={},l="",f.buttons&&(l=","+f.buttons+",");for(k in edButtons)edButtons[k]&&(j=edButtons[k].id,l&&m.indexOf(","+j+",")!==-1&&l.indexOf(","+j+",")===-1||edButtons[k].instance&&edButtons[k].instance!==a||(g[j]=edButtons[k],edButtons[k].html&&(h+=edButtons[k].html(e+"_"))));l&&l.indexOf(",dfw,")!==-1&&(g.dfw=new b.DFWButton,h+=g.dfw.html(e+"_")),"rtl"===document.getElementsByTagName("html")[0].dir&&(g.textdirection=new b.TextDirectionButton,h+=g.textdirection.html(e+"_")),i.toolbar.innerHTML=h,i.theButtons=g,"undefined"!=typeof jQuery&&jQuery(document).triggerHandler("quicktags-init",[i])}var d=this;if(a)c(a);else for(a in d.instances)c(a);d.buttonsInitDone=!0},b.addButton=function(a,c,d,e,f,g,h,i,j){var k;if(a&&c){if(h=h||0,e=e||"",j=j||{},"function"==typeof d)k=new b.Button(a,c,f,g,i,j),k.callback=d;else{if("string"!=typeof d)return;k=new b.TagButton(a,c,d,e,f,g,i,j)}if(h===-1)return k;if(h>0){for(;"undefined"!=typeof edButtons[h];)h++;edButtons[h]=k}else edButtons[edButtons.length]=k;this.buttonsInitDone&&this._buttonsInit()}},b.insertContent=function(a){var b,c,d,e,f,g,h=document.getElementById(wpActiveEditor);return!!h&&(document.selection?(h.focus(),b=document.selection.createRange(),b.text=a,h.focus()):h.selectionStart||0===h.selectionStart?(f=h.value,c=h.selectionStart,d=h.selectionEnd,e=h.scrollTop,h.value=f.substring(0,c)+a+f.substring(d,f.length),h.selectionStart=c+a.length,h.selectionEnd=c+a.length,h.scrollTop=e,h.focus()):(h.value+=a,h.focus()),document.createEvent?(g=document.createEvent("HTMLEvents"),g.initEvent("change",!1,!0),h.dispatchEvent(g)):h.fireEvent&&h.fireEvent("onchange"),!0)},b.Button=function(a,b,c,d,e,f){this.id=a,this.display=b,this.access="",this.title=d||"",this.instance=e||"",this.attr=f||{}},b.Button.prototype.html=function(b){var c,d,e,f=this.title?' title="'+a(this.title)+'"':"",g=this.attr&&this.attr.ariaLabel?' aria-label="'+a(this.attr.ariaLabel)+'"':"",h=this.display?' value="'+a(this.display)+'"':"",i=this.id?' id="'+a(b+this.id)+'"':"",j=(e=window.wp)&&e.editor&&e.editor.dfw;return"fullscreen"===this.id?'<button type="button"'+i+' class="ed_button qt-dfw qt-fullscreen"'+f+g+"></button>":"dfw"===this.id?(c=j&&j.isActive()?"":' disabled="disabled"',d=j&&j.isOn()?" active":"",'<button type="button"'+i+' class="ed_button qt-dfw'+d+'"'+f+g+c+"></button>"):'<input type="button"'+i+' class="ed_button button button-small"'+f+g+h+" />"},b.Button.prototype.callback=function(){},b.TagButton=function(a,c,d,e,f,g,h,i){var j=this;b.Button.call(j,a,c,f,g,h,i),j.tagStart=d,j.tagEnd=e},b.TagButton.prototype=new b.Button,b.TagButton.prototype.openTag=function(a,b){b.openTags||(b.openTags=[]),this.tagEnd&&(b.openTags.push(this.id),a.value="/"+a.value,this.attr.ariaLabelClose&&a.setAttribute("aria-label",this.attr.ariaLabelClose))},b.TagButton.prototype.closeTag=function(a,b){var c=this.isOpen(b);c!==!1&&b.openTags.splice(c,1),a.value=this.display,this.attr.ariaLabel&&a.setAttribute("aria-label",this.attr.ariaLabel)},b.TagButton.prototype.isOpen=function(a){var b=this,c=0,d=!1;if(a.openTags)for(;d===!1&&c<a.openTags.length;)d=a.openTags[c]===b.id&&c,c++;else d=!1;return d},b.TagButton.prototype.callback=function(a,b,c){var d,e,f,g,h,i,j,k,l,m=this,n=b.value,o=n?m.tagEnd:"";document.selection?(b.focus(),k=document.selection.createRange(),k.text.length>0?m.tagEnd?k.text=m.tagStart+k.text+o:k.text=k.text+m.tagStart:m.tagEnd?m.isOpen(c)===!1?(k.text=m.tagStart,m.openTag(a,c)):(k.text=o,m.closeTag(a,c)):k.text=m.tagStart,b.focus()):b.selectionStart||0===b.selectionStart?(d=b.selectionStart,e=b.selectionEnd,d<e&&"\n"===n.charAt(e-1)&&(e-=1),f=e,g=b.scrollTop,h=n.substring(0,d),i=n.substring(e,n.length),j=n.substring(d,e),d!==e?m.tagEnd?(b.value=h+m.tagStart+j+o+i,f+=m.tagStart.length+o.length):(b.value=h+j+m.tagStart+i,f+=m.tagStart.length):m.tagEnd?m.isOpen(c)===!1?(b.value=h+m.tagStart+i,m.openTag(a,c),f=d+m.tagStart.length):(b.value=h+o+i,f=d+o.length,m.closeTag(a,c)):(b.value=h+m.tagStart+i,f=d+m.tagStart.length),b.selectionStart=f,b.selectionEnd=f,b.scrollTop=g,b.focus()):(o?m.isOpen(c)!==!1?(b.value+=m.tagStart,m.openTag(a,c)):(b.value+=o,m.closeTag(a,c)):b.value+=m.tagStart,b.focus()),document.createEvent?(l=document.createEvent("HTMLEvents"),l.initEvent("change",!1,!0),b.dispatchEvent(l)):b.fireEvent&&b.fireEvent("onchange")},b.SpellButton=function(){},b.CloseButton=function(){b.Button.call(this,"close",quicktagsL10n.closeTags,"",quicktagsL10n.closeAllOpenTags)},b.CloseButton.prototype=new b.Button,b._close=function(a,b,c){var d,e,f=c.openTags;if(f)for(;f.length>0;)d=c.getButton(f[f.length-1]),e=document.getElementById(c.name+"_"+d.id),a?d.callback.call(d,e,b,c):d.closeTag(e,c)},b.CloseButton.prototype.callback=b._close,b.closeAllTags=function(a){var c=this.getInstance(a);c&&b._close("",c.canvas,c)},b.LinkButton=function(){var a={ariaLabel:quicktagsL10n.link};b.TagButton.call(this,"link","link","","</a>","","","",a)},b.LinkButton.prototype=new b.TagButton,b.LinkButton.prototype.callback=function(a,c,d,e){var f,g=this;return"undefined"!=typeof wpLink?void wpLink.open(d.id):(e||(e="http://"),void(g.isOpen(d)===!1?(f=prompt(quicktagsL10n.enterURL,e),f&&(g.tagStart='<a href="'+f+'">',b.TagButton.prototype.callback.call(g,a,c,d))):b.TagButton.prototype.callback.call(g,a,c,d)))},b.ImgButton=function(){var a={ariaLabel:quicktagsL10n.image};b.TagButton.call(this,"img","img","","","","","",a)},b.ImgButton.prototype=new b.TagButton,b.ImgButton.prototype.callback=function(a,c,d,e){e||(e="http://");var f,g=prompt(quicktagsL10n.enterImageURL,e);g&&(f=prompt(quicktagsL10n.enterImageDescription,""),this.tagStart='<img src="'+g+'" alt="'+f+'" />',b.TagButton.prototype.callback.call(this,a,c,d))},b.DFWButton=function(){b.Button.call(this,"dfw","","f",quicktagsL10n.dfw)},b.DFWButton.prototype=new b.Button,b.DFWButton.prototype.callback=function(){var a;(a=window.wp)&&a.editor&&a.editor.dfw&&window.wp.editor.dfw.toggle()},b.TextDirectionButton=function(){b.Button.call(this,"textdirection",quicktagsL10n.textdirection,"",quicktagsL10n.toggleTextdirection)},b.TextDirectionButton.prototype=new b.Button,b.TextDirectionButton.prototype.callback=function(a,b){var c="rtl"===document.getElementsByTagName("html")[0].dir,d=b.style.direction;d||(d=c?"rtl":"ltr"),b.style.direction="rtl"===d?"ltr":"rtl",b.focus()},edButtons[10]=new b.TagButton("strong","b","<strong>","</strong>","","","",{ariaLabel:quicktagsL10n.strong,ariaLabelClose:quicktagsL10n.strongClose}),edButtons[20]=new b.TagButton("em","i","<em>","</em>","","","",{ariaLabel:quicktagsL10n.em,ariaLabelClose:quicktagsL10n.emClose}),edButtons[30]=new b.LinkButton,edButtons[40]=new b.TagButton("block","b-quote","\n\n<blockquote>","</blockquote>\n\n","","","",{ariaLabel:quicktagsL10n.blockquote,ariaLabelClose:quicktagsL10n.blockquoteClose}),edButtons[50]=new b.TagButton("del","del",'<del datetime="'+d+'">',"</del>","","","",{ariaLabel:quicktagsL10n.del,ariaLabelClose:quicktagsL10n.delClose}),edButtons[60]=new b.TagButton("ins","ins",'<ins datetime="'+d+'">',"</ins>","","","",{ariaLabel:quicktagsL10n.ins,ariaLabelClose:quicktagsL10n.insClose}),edButtons[70]=new b.ImgButton,edButtons[80]=new b.TagButton("ul","ul","<ul>\n","</ul>\n\n","","","",{ariaLabel:quicktagsL10n.ul,ariaLabelClose:quicktagsL10n.ulClose}),edButtons[90]=new b.TagButton("ol","ol","<ol>\n","</ol>\n\n","","","",{ariaLabel:quicktagsL10n.ol,ariaLabelClose:quicktagsL10n.olClose}),edButtons[100]=new b.TagButton("li","li","\t<li>","</li>\n","","","",{ariaLabel:quicktagsL10n.li,ariaLabelClose:quicktagsL10n.liClose}),edButtons[110]=new b.TagButton("code","code","<code>","</code>","","","",{ariaLabel:quicktagsL10n.code,ariaLabelClose:quicktagsL10n.codeClose}),edButtons[120]=new b.TagButton("more","more","<!--more-->\n\n","","","","",{ariaLabel:quicktagsL10n.more}),edButtons[140]=new b.CloseButton}();